package com.gis507.admin.exception;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * 用来处理整个web controller的异常
 * @author LnnuUser
 * @create 2021-07-06-下午3:36
 */
@Slf4j
@ControllerAdvice
public class GlobalExceptionHandler {

    //用于处理运算异常和空指针异常
    @ExceptionHandler({ArithmeticException.class,NullPointerException.class})
    public String handleArithException(Exception e){
        log.error("异常是：{}",e);
        return "login";
    }
}
